export default {
  data () {
    return {
      onlineSettleDetailRow: {
        searchParams:{},
        pageNumber:1,
        total: 0,
        searchList: [
          { index: 0, isShow: false, type: 'text', name: 'traderName', text: '商家名称', value: '' }
        ],
        theadsInfo: [
          { index: 0, isShow: false, prop: 'reno', text: '序号', width: 68 },
          { index: 1, isShow: false, prop: 'reportDate', text: '日期', minWidth: 110 },
          { index: 2, isShow: false, prop: 'traderCode', text: '商家代码', minWidth: 155 },
          { index: 3, isShow: false, prop: 'traderName', text: '商家名称', minWidth: 155 },
          { index: 4, isShow: false, prop: 'settleNum', text: '结算数量', minWidth: 110 },
          { index: 5, isShow: false, prop: 'settleMoney', text: '结算金额', minWidth: 110 }
        ],
        tbodysInfo: []
      },
      onlineSettleReportRow:{}
    }
  },
  created () {
    //this.getList();
  },
  methods: {
    getList () {
      this.getAkeReport(this.searchParams);
    },
    getAkeReport (aparams) {//查询列表
      let self = this,
          params = {
            page: this.pageNumber,
            rp: this.pageSize
          };
      params = $.extend({}, params, aparams);
      API.report.GetAkeReportData(params)
          .then(res => {
            let data = res.data,
                list = data.rows;
            self.tbodysInfo = list;
            self.total = data.total;
          }, err => {})
    },
    exportData(){//导出
      let self = this;
      this.showDialog("是否确认导出记录？",[],function(){
        let params = {
        };
        params = $.extend({}, params, self.searchParams);
        self.toExport('/report/ake/exportAkeReport.do', params);
      },"温馨提示",function(){
        //取消时不操作
      });
    },
    toOpenOnlineSettleReportDetail(row,modalName){//打开详情
      this.onlineSettleReportRow = row;
      this.toOpenModal(modalName);
      this.getAkeDayReportDetailData();
    },
    getAkeDayReportDetailData(aparams){//获取详情列表
      let self = this,
      params = {
        "id":this.onlineSettleReportRow.id,
        page: 1,
        rp: 999999
      };
      params = $.extend({}, params, aparams);
      API.report.GetAkeDayReportDetailData(params)
          .then(res => {
            let data = res.data,
                list = data.rows;
            self.onlineSettleDetailRow.tbodysInfo = list;
            self.onlineSettleDetailRow.total = data.total;
            self.onlineSettleDetailRow.pageNumber = data.page;
          }, err => {})
    },
    toSearchOnlineSettleReportDetail(params){//弹出窗的列表搜索方法
      this.onlineSettleDetailRow.pageNumber = 1;
      this.onlineSettleDetailRow.searchParams = $.extend({}, params);
      this.getAkeDayReportDetailData(params);
    },
    getOnlineSettletDetailPagination(curPage, pageSize) {
      this.onlineSettleDetailRow.pageNumber = curPage;
      this.onlineSettleDetailRow.pageSize = pageSize ? pageSize : this.onlineSettleDetailRow.pageSize;
      this.getAkeDayReportDetailData(this.onlineSettleDetailRow.searchParams);
    },
    // auditOnlineSettleReport(row){//审核
    //   let self = this;
    //   this.showDialog("是否确定要审批该商家的券报表？",[],function(){
    //     API.report.AuditAkeDayReport({"id":row.id}).then(res => {
    //       if(res.status==1){
    //         self.getList();
    //         self.showToast("操作成功",1);
    //       }else{
    //         self.showToast("操作失败",2);
    //       }
    //     }, err =>{});
    //   },"温馨提示",function(){
    //     //取消时不操作
    //   });
    // },
    confirmOnlineSettle(row){//确认现金收款
      let self = this;
      this.showDialog("是否确定要现金结算未支付的商家账单？",[],function(){
        API.report.ConfirmSettleAkeDayReport({"id":row.id}).then(res => {
          if(res.status==1){
            self.getList();
            self.showToast("操作成功",1);
          }else{
            self.showToast("操作失败",2);
          }
        }, err =>{});
      },"温馨提示",function(){
        //取消时不操作
      });
    },
    filterMultiCheck (selectionArr) {//必须定义获取多列的方法
      let result = [];
        selectionArr.map((item)=>{
          result.push(item.id);
        });
      return result;
    }
  }
}